﻿<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="com.kylin.module.study.orm.Courseware" %>
<%@ include file="/common/include/taglibs.jsp"%>
<%@ include file="/common/include/dictNames.jsp"%>
<%@ include file="/common/include/pageExpires.jsp"%> 

<table width="90%" border="0" align="center">
  <tr>
    <td align="left" >学习管理→课件管理→添加课件</td>
  </tr>
</table>
<p><br />
</p>
<script>
	/* 根据指定的语言从隐含的类别数据列中取得相应选项，动态加入到类别下拉菜单 */
	function changeSelect(language,srcList,targetList){
		targetList.length = 1;
	    for(var i=0;i<srcList.length;i++){
	       if(srcList.options[i].language==language){
	           targetList.length = targetList.length+1;
	           targetList.options[targetList.length-1].value = srcList.options[i].value;
	           targetList.options[targetList.length-1].text  = srcList.options[i].text;	 
	       }
	    }
	}

	function changeTowList(language){
		changeSelect(language,
		             document.fo1.datalist1,
		             document.fo1.catcoursewareid); //页面显示后直接初始化
		changeSelect(language,
		             document.fo1.datalist2,
		             document.fo1.catarticleid); //页面显示后直接初始化
	}
	function checkSubmit(nextdo){
		if(document.fo1.language.value==document.fo1.targetlang.value){
		    alert("母语和学习语言不能相同")
		    return;
		}
		if(document.fo1.catcoursewareid.value==""){
		    alert("请选择课件类别")
		    return;
		}
	    document.fo1.nextdo.value=nextdo;
	    document.fo1.submit();
	}
</script>
<mytag:MyActionMsg />
<form name="fo1" action="/admin/study/manageCourseware.do?CMD=add" method="post" enctype="multipart/form-data">
<input type="hidden" name="nextdo" value="add">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td width="29%" align="right">母语： </td>
    <td width="71%" align="left"><p>
      <mytag:national name="language" notEmpty="true"
		onchange="changeTowList(this.value)" value="<%=sessionLocale.toString()%>"
					dictName="<%=Constants.SYSLANGUAGE%>" />
    </p>    </td>
  </tr>
  <tr>
    <td align="right">学习语言：</td>
    <td align="left">
      <mytag:national name="targetlang" notEmpty="true"
					value="<%=sessionLocale.toString()%>"
					dictName="<%=Constants.SYSLANGUAGE%>" />
    </td>
  </tr>
    <tr>
    <td align="right">所属分类：</td>
    <td align="left">
      <select name="catcoursewareid">
		<option value="">-- 请选择 --</option>
	  </select>
<div style="position:absolute; visibility:hidden; ">
  <mytag:select name="datalist1" notEmpty="true" language="all" dictName="<%=dict_cat_study2%>" />
</div>
    </td>
  </tr>
  <tr>
    <td align="right">所属文章分类：</td>
    <td align="left">
      <select name="catarticleid">
		<option value="">-- 请选择 --</option>
	  </select>
<div style="position:absolute; visibility:hidden; ">
  <mytag:select name="datalist2" notEmpty="true" language="all" dictName="<%=dict_cat_study3%>" />
</div>
    </td>
  </tr>
  <script>
		changeTowList(document.fo1.language.value)//页面显示后直接初始化两个下拉菜单
  </script>  
  
  <tr>
    <td align="right">课件名称：</td>
    <td align="left">
      <input type="text" name="title" />
    </td>
  </tr>
  <tr>
    <td align="right">上传课件：</td>
    <td align="left">
      <input type="file" name="mediapath" />请添加swf、mp3、wma类型的语音文件
    </td>
  </tr>
  <tr>
    <td align="right">译文：</td>
    <td align="left">
      <textarea name="translatation"></textarea>
    </td>
  </tr>
    <tr>
    <td align="right">设为首页</td>
    <td align="left">
      <input type="checkbox" name="active" value=<%=Courseware.COURSEWARE_TOP %>/>
    </td>
  </tr>
  <tr>
    <td height="43" align="right">&nbsp;</td>
    <td>
      <input type="button" name="Submit" onclick="checkSubmit('add')" value="保存并继续添加" />
      <input type="button" name="Submit" onclick="checkSubmit('list')" value="保存并返回列表" />
    </td>
  </tr>
</table>
</form>